/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package carshow;

import javax.swing.JWindow;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.BorderFactory;
import java.awt.Color;
import java.awt.Dimension;

/**
 * Splash screen window displayed during initialization.
 * @author Wayne Motycka
 */
public class Splash extends JWindow {
    protected ImageIcon carshowlogo;
    protected JLabel prodName;
    
    public Splash() {
        ClassLoader cl = getClass().getClassLoader();
        carshowlogo = new ImageIcon(cl.getResource("icons/carshowlogo.gif"));
        prodName = new JLabel("<html>"
                + "<div style=\"text-align:center\"><font face=\"Papyrus\" size=10>"
                +"Car Show Conductor<br/>"
                +"v"+CarShowConstants.CarShowVersion+"</div></html>", carshowlogo, JLabel.CENTER);
        prodName.setOpaque(true);
        prodName.setBorder(
            BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(10,10,10,10),
            BorderFactory.createLineBorder(Color.black)));
        getContentPane().add(prodName);
        Dimension dim = prodName.getPreferredSize();
        dim.setSize(dim.getWidth()+10, dim.getHeight()+10);
        setSize(dim);
        // position the splash window in the center of the screen
        Dimension windsize = this.getToolkit().getScreenSize();
        this.setLocation(windsize.width/2 - (int)this.getWidth()/2,
            windsize.height/2 - (int)this.getHeight()/2);
        setVisible(true);
    }
    /**
     * remove the splash screen
     */
    public void remove() {
        dispose();
    }
}
